<template>
	<view class="fankuilist">
		<headertop title="意见反馈" str="orderlist" str1="oridei" :back1="back1"></headertop>
		<view class="fankuiback">

		</view>
		<view class="" :style="{'margin-top':statusBarHeight+'px','width':'100%','height':barHeight+'px'}">
		</view>
		<view class="fankuiList">
			<view class="msgicon" v-if="!list.length">
				<image :src="_static('/images/wxnone.png')" mode="widthFix">
				</image>
				<view class="msgtext">
					暂无反馈
				</view>
			</view>
			<view class="itemboxs" v-if="list.length" v-for="(item,index) in  list" :key="index">
				<view class="topline">
					手机号：{{item.phone}} <span
						:style="{'color':item.status!=0?'#3c9cff':'#fda735 '}">{{item.status==0?'待处理':'已处理'}}</span>
				</view>
				<view class="bottbox">
					<view class="texts">
						{{item.content}}
					</view>
					<view class="tijiaotime">
						提交时间：{{item.createtime}}
					</view>
				</view>
			</view>
		</view>
		<view class="" style="height: 230rpx;">

		</view>
		<view class="fixed">
			<view class="btn" @click="add('add')">
				我要反馈
			</view>
		</view>
	</view>
</template>

<script setup>
	import headertop from '@/components/header.vue'
	import {
		_static
	} from '@/ulm/utils/url.js'
	import {
		$api
	} from '@/ulm/index.js'
	import {
		ref,
		reactive,
		onMounted
	} from 'vue'
	import {
		onLoad,
		onShow,
		onPageScroll,
		onReachBottom
	} from "@dcloudio/uni-app";
	const statusBarHeight = ref('')
	const barHeight = ref('')
	const back1 = ref('')
	const list = ref([])
	const query = reactive({
		page: 1,
		list_rows: 10
	})
	const total = ref(0)
	onShow(() => {
		list.value = []
		query.page = 1
		init()
	})
	onReachBottom(() => {
		if (total.value > list.length) {
			query.page++
			init()
		}
	})
	onMounted(() => {
		statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight
		const {
			top,
			height
		} = wx.getMenuButtonBoundingClientRect();
		barHeight.value = height ? height + (top - statusBarHeight.value) * 2 : 38;
	})
	onPageScroll((e) => {
		if (e.scrollTop > 100) {
			back1.value = '#81D6FF'
		} else {
			back1.value = ''
		}
	})
	
	async function init() {
		const res = await $api.feedbackList()
		if (res.code == 1) {
			total.value = res.data.total
			list.value.push(...res.data.data)
		}
	}



	function add(str) {
		console.log(123123);
		if (str == 'add') {
			uni.navigateTo({
				url: '/sub_my/my/fankuicreate'
			})
		} else {
			uni.navigateTo({
				url: '/sub_my/my/fankuicreate?id=' + str.id
			})
		}
	}
	
</script>

<style lang="scss">
	.msgicon {
		width: 608rpx;
		margin: 100rpx auto;
		overflow: hidden;

		.msgtext {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 28rpx;
			color: #86909C;
			text-align: center;
			width: 100%;
			margin-top: 30rpx;
		}

		image {
			width: 608rpx;
		}
	}

	.fixed {
		width: 100%;
		overflow: hidden;
		position: fixed;
		bottom: 0%;
		background: #FFFFFF;
		height: 194rpx;

		.btn {
			width: 686rpx;
			height: 88rpx;
			background: #2AB4F5;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			text-align: center;
			line-height: 88rpx;
			font-weight: 400;
			font-size: 30rpx;
			color: #FFFFFF;
			margin: auto;
			margin-top: 32rpx;
			box-shadow: 0rpx -6rpx 14rpx 0rpx rgba(0, 0, 0, 0.03);
		}
	}

	page {
		background: #F7F8FA;
	}

	.fankuilist {
		width: 100%;
		overflow: hidden;
		position: relative;

		.fankuiback {
			width: 100%;
			height: 278rpx;
			background: linear-gradient(180deg, #CAEEFF 71%, rgba(240, 250, 255, 0) 100%);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			position: absolute;
			z-index: -1;
		}

		.fankuiList {
			width: 686rpx;
			overflow: hidden;
			margin: auto;
			margin-top: 32rpx;

			.itemboxs {
				width: 100%;
				overflow: hidden;
				background: #FFFFFF;
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				margin-bottom: 32rpx;

				.topline {
					width: 630rpx;
					margin: auto;
					height: 92rpx;
					border-bottom: 2rpx solid #F2F2F2;
					line-height: 92rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #4E5969;
					display: flex;
					justify-content: space-between;
				}

				.bottbox {
					width: 630rpx;
					margin: auto;

					.texts {
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 28rpx;
						color: #4E5969;
						margin-top: 16rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
					}

					.tijiaotime {
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 28rpx;
						color: #86909C;
						margin-top: 26rpx;
						margin-bottom: 28rpx;
					}
				}
			}
		}
	}
</style>